package com.yegs.jltqc.util;

import org.springframework.web.multipart.MultipartFile;

import java.io.*;
public class FileUtils {

    public final static String PATH_BASE = "D:/jltqc/img/";
    public final static String PATH_PRE = "/img/";

    public static String upload(MultipartFile file) throws IOException {
        String name = file.getOriginalFilename();
        String fileName = UUID.get() + name.substring(name.lastIndexOf("."));
        name = PATH_BASE+ fileName;
        File file1 = new File(name);
        file.transferTo(file1);
        return PATH_PRE + fileName;
    }
}
